//
//  WHCIAFooterView.m
//  WHEasyBizLink
//
//  Created by shengmeng chen on 2024/11/25.
//

#import "WHCIAFooterView.h"
#import "SDAutoLayout.h"

@implementation WHCIAFooterView

-(void)createUIControls
{
    [super createUIControls];
    
//    UIButton*selectBtn = [[UIButton alloc] init];
////    selectBtn.layer.cornerRadius  = 3;
////    selectBtn.layer.masksToBounds = YES;
////    selectBtn.layer.borderWidth   = 0.5;
////    selectBtn.layer.borderColor   = [UIColor lightGrayColor].CGColor;
//    [selectBtn setBackgroundImage:[UIImage imageNamed:@"noSelect"] forState:UIControlStateNormal];
//    [selectBtn setBackgroundImage:[UIImage imageNamed:@"select"] forState:UIControlStateSelected];
//    
//    [selectBtn setTitleColor:RGBColor(106, 168, 255) forState:UIControlStateNormal];
//    selectBtn.titleLabel.font =[UIFont systemFontOfSize:20];
//    _selectBtn = selectBtn;
//    
//   [selectBtn addTarget:self action:@selector(clickBtn:)
//      forControlEvents:UIControlEventTouchUpInside];
//    
//    [self addSubview:selectBtn];
//    
//    UIButton*reviewBtn = [[UIButton alloc] init];
//
//    [reviewBtn setTitle:@"我已阅读并同意《企业信息申报协议》" forState:UIControlStateNormal];
//    [reviewBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    reviewBtn.titleLabel.textAlignment =NSTextAlignmentLeft;
//    [reviewBtn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
//    reviewBtn.titleLabel.font =[UIFont systemFontOfSize:17*WidthScale>19?19:17*WidthScale];
//    _reviewBtn = reviewBtn;
////   [reviewBtn addTarget:self action:@selector(submitBtn:)
////      forControlEvents:UIControlEventTouchUpInside];
//    [self addSubview:reviewBtn];
    
    self.backgroundColor =RGBColor(250,250,250);
    UIButton*submitBtn = [[UIButton alloc] init];

    [submitBtn setTitle:@"提交" forState:UIControlStateNormal];
    [submitBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    submitBtn.backgroundColor = RGBColor(54,141,246);
    submitBtn.titleLabel.font = [UIFont systemFontOfSize:20];
    
    submitBtn.layer.cornerRadius  = kMarginH*2.25;
    submitBtn.layer.masksToBounds = YES;
    _submitBtn = submitBtn;
   [submitBtn addTarget:self action:@selector(submitBtnClick:)
      forControlEvents:UIControlEventTouchUpInside];

    [self addSubview:submitBtn];
    
    [self setUpUIControlsLayouts];
}

-(void)setUpUIControlsLayouts
{
//    _selectBtn.sd_layout.
//    topSpaceToView(self,kMarginH*2)
//    .leftSpaceToView(self,kMarginW*2)
//    .widthIs(kMarginH*1.5)
//    .heightIs(kMarginH*1.5);
//    
//    _reviewBtn.sd_layout.
//    centerYEqualToView(_selectBtn)
//    .leftSpaceToView(_selectBtn,kMarginW)
//    .rightSpaceToView(self,kMarginW*2)
//    .heightIs(kMarginH*3);
    
    _submitBtn.sd_layout.
    topSpaceToView(self.reviewBtn,kMarginH*2)
    .leftSpaceToView(self,40)
    .rightSpaceToView(self,40)
    .heightIs(kMarginH*4.5);
    
}

-(void)clickBtn:(UIButton*)btn
{
    btn.selected = !btn.selected;
    
}

-(void)submitBtnClick:(UIButton*)btn
{
    if(self.clickBtnBlock)
    {
        self.clickBtnBlock(btn);
    }
}

@end
